home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Apple WWDC 1996
/
WWDC96_1996 (CD).toast
/
Technology Materials
/
MacOS 8 Resources
/
Developer Tools
/
Mac OS 8 Interfaces & Libraries
/
Interfaces
/
AIncludes
/
Components.a
< prev
next >
Wrap
Text File
|
1996-05-01
|
16KB
|
595 lines
;
; File: Components.a
;
; Contains: Component Manager Interfaces.
;
; Version: Technology: System 7.5
; Release: Universal Interfaces 3.0d3 on Copland DR1
;
; Copyright: © 1984-1996 by Apple Computer, Inc. All rights reserved.
;
; Bugs?: If you find a problem with this file, send the file and version
; information (from above) and the problem description to:
;
; Internet: apple.bugs@applelink.apple.com
; AppleLink: APPLE.BUGS
;
;
IF &TYPE('__COMPONENTS__') = 'UNDEFINED' THEN
__COMPONENTS__ SET 1
IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
include 'Types.a'
ENDIF
IF &TYPE('__MIXEDMODE__') = 'UNDEFINED' THEN
include 'MixedMode.a'
ENDIF
IF FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE THEN
kAppleManufacturer EQU 'appl' ; Apple supplied components
kComponentResourceType EQU 'thng' ; a components resource type
kAnyComponentType EQU 0
kAnyComponentSubType EQU 0
kAnyComponentManufacturer EQU 0
kAnyComponentFlagsMask EQU 0
cmpWantsRegisterMessage EQU $80000000
kComponentOpenSelect EQU -1 ; ComponentInstance for this open
kComponentCloseSelect EQU -2 ; ComponentInstance for this close
kComponentCanDoSelect EQU -3 ; selector # being queried
kComponentVersionSelect EQU -4 ; no params
kComponentRegisterSelect EQU -5 ; no params
kComponentTargetSelect EQU -6 ; ComponentInstance for top of call chain
kComponentUnregisterSelect EQU -7 ; no params
kComponentGetMPWorkFunctionSelect EQU -8 ; some params
; Component Resource Extension flags
componentDoAutoVersion EQU $01
componentWantsUnregister EQU $02
componentAutoVersionIncludeFlags EQU $04
componentHasMultiplePlatforms EQU $08
; Set Default Component flags
defaultComponentIdentical EQU 0
defaultComponentAnyFlags EQU 1
defaultComponentAnyManufacturer EQU 2
defaultComponentAnySubType EQU 4
defaultComponentAnyFlagsAnyManufacturer EQU 3
defaultComponentAnyFlagsAnyManufacturerAnySubType EQU 7
; RegisterComponentResource flags
registerComponentGlobal EQU 1
registerComponentNoDuplicates EQU 2
registerComponentAfterExisting EQU 4
ComponentDescription RECORD 0
componentType ds.l 1 ; offset: $0 (0) ; A unique 4-byte code indentifying the command set
componentSubType ds.l 1 ; offset: $4 (4) ; Particular flavor of this instance
componentManufacturer ds.l 1 ; offset: $8 (8) ; Vendor indentification
componentFlags ds.l 1 ; offset: $C (12) ; 8 each for Component,Type,SubType,Manuf/revision
componentFlagsMask ds.l 1 ; offset: $10 (16) ; Mask for specifying which flags to consider in search, zero during registration
sizeof EQU * ; size: $14 (20)
ENDR
ResourceSpec RECORD 0
resType ds.l 1 ; offset: $0 (0) ; 4-byte code
resID ds.w 1 ; offset: $4 (4)
sizeof EQU * ; size: $6 (6)
ENDR
ComponentResource RECORD 0
cd ds ComponentDescription ; offset: $0 (0) ; Registration parameters
component ds ResourceSpec ; offset: $14 (20) ; resource where Component code is found
componentName ds ResourceSpec ; offset: $1A (26) ; name string resource
componentInfo ds ResourceSpec ; offset: $20 (32) ; info string resource
componentIcon ds ResourceSpec ; offset: $26 (38) ; icon resource
sizeof EQU * ; size: $2C (44)
ENDR
; typedef struct ComponentResource * ComponentResourcePtr
; typedef ComponentResourcePtr * ComponentResourceHandle
ComponentPlatformInfo RECORD 0
componentFlags ds.l 1 ; offset: $0 (0) ; flags of Component
component ds ResourceSpec ; offset: $4 (4) ; resource where Component code is found
platformType ds.w 1 ; offset: $A (10) ; gestaltSysArchitecture result
sizeof EQU * ; size: $C (12)
ENDR
ComponentResourceExtension RECORD 0
componentVersion ds.l 1 ; offset: $0 (0) ; version of Component
componentRegisterFlags ds.l 1 ; offset: $4 (4) ; flags for registration
componentIconFamily ds.w 1 ; offset: $8 (8) ; resource id of Icon Family
sizeof EQU * ; size: $A (10)
ENDR
ComponentPlatformInfoArray RECORD 0
count ds.l 1 ; offset: $0 (0)
platformArray ds ComponentPlatformInfo ; offset: $4 (4) <-- really an array of length one
sizeof EQU * ; size: $10 (16)
ENDR
ExtComponentResource RECORD 0
cd ds ComponentDescription ; offset: $0 (0) ; registration parameters
component ds ResourceSpec ; offset: $14 (20) ; resource where Component code is found
componentName ds ResourceSpec ; offset: $1A (26) ; name string resource
componentInfo ds ResourceSpec ; offset: $20 (32) ; info string resource
componentIcon ds ResourceSpec ; offset: $26 (38) ; icon resource
componentVersion ds.l 1 ; offset: $2C (44) ; version of Component
componentRegisterFlags ds.l 1 ; offset: $30 (48) ; flags for registration
componentIconFamily ds.w 1 ; offset: $34 (52) ; resource id of Icon Family
count ds.l 1 ; offset: $36 (54) ; elements in platformArray
platformArray ds ComponentPlatformInfo ; offset: $3A (58) <-- really an array of length one
sizeof EQU * ; size: $46 (70)
ENDR
ComponentParameters RECORD 0
flags ds.b 1 ; offset: $0 (0) ; call modifiers: sync/async, deferred, immed, etc
paramSize ds.b 1 ; offset: $1 (1) ; size in bytes of actual parameters passed to this call
what ds.w 1 ; offset: $2 (2) ; routine selector, negative for Component management calls
params ds.l 1 ; offset: $4 (4) <-- really an array of length one ; actual parameters for the indicated routine
sizeof EQU * ; size: $8 (8)
ENDR
ComponentRecord RECORD 0
data ds.l 1 ; offset: $0 (0) <-- really an array of length one
sizeof EQU * ; size: $4 (4)
ENDR
; typedef struct ComponentRecord * Component
ComponentInstanceRecord RECORD 0
data ds.l 1 ; offset: $0 (0) <-- really an array of length one
sizeof EQU * ; size: $4 (4)
ENDR
; typedef struct ComponentInstanceRecord * ComponentInstance
; typedef long ComponentResult
mpWorkFlagDoWork EQU $01
mpWorkFlagDoCompletion EQU $02
mpWorkFlagCopyWorkBlock EQU $04
mpWorkFlagDontBlock EQU $08
mpWorkFlagGetProcessorCount EQU $10
ComponentMPWorkFunctionHeaderRecord RECORD 0
headerSize ds.l 1 ; offset: $0 (0)
recordSize ds.l 1 ; offset: $4 (4)
workFlags ds.l 1 ; offset: $8 (8)
processorCount ds.w 1 ; offset: $C (12)
unused ds.w 1 ; offset: $E (14)
sizeof EQU * ; size: $10 (16)
ENDR
; typedef struct ComponentMPWorkFunctionHeaderRecord * ComponentMPWorkFunctionHeaderRecordPtr
; typedef ComponentRoutineProcPtr ComponentRoutine
;
; The parameter list for each ComponentFunction is unique. It is
; therefore up to users to create the appropriate procInfo for their
; own ComponentFunctions where necessary.
;
; typedef UniversalProcPtr ComponentFunctionUPP
; Component Database Add, Delete, and Query Routines
;
; pascal Component RegisterComponent(ComponentDescription *cd, ComponentRoutineUPP componentEntryPoint, short global, Handle componentName, Handle componentInfo, Handle componentIcon)
;
IF ¨ GENERATINGCFM THEN
Macro
_RegisterComponent
moveq #1,D0
dc.w $A82A
EndM
ELSE
IMPORT_CFM_FUNCTION RegisterComponent
ENDIF
;
; pascal Component RegisterComponentResource(ComponentResourceHandle tr, short global)
;
IF ¨ GENERATINGCFM THEN
Macro
_RegisterComponentResource
moveq #18,D0
dc.w $A82A
EndM
ELSE
IMPORT_CFM_FUNCTION RegisterComponentResource
ENDIF
;
; pascal OSErr UnregisterComponent(Component aComponent)
;
IF ¨ GENERATINGCFM THEN
Macro
_UnregisterComponent
moveq #2,D0
dc.w $A82A
EndM
ELSE
IMPORT_CFM_FUNCTION UnregisterComponent
ENDIF
;
; pascal Component FindNextComponent(Component aComponent, ComponentDescription *looking)
;
IF ¨ GENERATINGCFM THEN
Macro
_FindNextComponent
moveq #4,D0
dc.w $A82A
EndM
ELSE
IMPORT_CFM_FUNCTION FindNextComponent
ENDIF
;
; pascal long CountComponents(ComponentDescription *looking)
;
IF ¨ GENERATINGCFM THEN
Macro
_CountComponents
moveq #3,D0
dc.w $A82A
EndM
ELSE
IMPORT_CFM_FUNCTION CountComponents
ENDIF
;
; pascal OSErr GetComponentInfo(Component aComponent, ComponentDescription *cd, Handle componentName, Handle componentInfo, Handle componentIcon)
;
IF ¨ GENERATINGCFM THEN
Macro
_GetComponentInfo
moveq #5,D0
dc.w $A82A
EndM
ELSE
IMPORT_CFM_FUNCTION GetComponentInfo
ENDIF
;
; pascal long GetComponentListModSeed(void )
;
IF ¨ GENERATINGCFM THEN
Macro
_GetComponentListModSeed
moveq #6,D0
dc.w $A82A
EndM
ELSE
IMPORT_CFM_FUNCTION GetComponentListModSeed
ENDIF
; Component Instance Allocation and dispatch routines
;
; pascal ComponentInstance OpenComponent(Component aComponent)
;
IF ¨ GENERATINGCFM THEN
Macro
_OpenComponent
moveq #7,D0
dc.w $A82A
EndM
ELSE
IMPORT_CFM_FUNCTION OpenComponent
ENDIF
;
; pascal OSErr CloseComponent(ComponentInstance aComponentInstance)
;
IF ¨ GENERATINGCFM THEN
Macro
_CloseComponent
moveq #8,D0
dc.w $A82A
EndM
ELSE
IMPORT_CFM_FUNCTION CloseComponent
ENDIF
;
; pascal OSErr GetComponentInstanceError(ComponentInstance aComponentInstance)
;
IF ¨ GENERATINGCFM THEN
Macro
_GetComponentInstanceError
moveq #10,D0
dc.w $A82A
EndM
ELSE
IMPORT_CFM_FUNCTION GetComponentInstanceError
ENDIF
; Direct calls to the Components
;
; pascal long ComponentFunctionImplemented(ComponentInstance ci, short ftnNumber)
;
IF ¨ GENERATINGCFM THEN
Macro
_ComponentFunctionImplemented
move.l #$0002FFFD,-(sp)
moveq #0,D0
dc.w $A82A
EndM
ELSE
IMPORT_CFM_FUNCTION ComponentFunctionImplemented
ENDIF
;
; pascal long GetComponentVersion(ComponentInstance ci)
;
IF ¨ GENERATINGCFM THEN
Macro
_GetComponentVersion
move.l #$0000FFFC,-(sp)
moveq #0,D0
dc.w $A82A
EndM
ELSE
IMPORT_CFM_FUNCTION GetComponentVersion
ENDIF
;
; pascal long ComponentSetTarget(ComponentInstance ci, ComponentInstance target)
;
IF ¨ GENERATINGCFM THEN
Macro
_ComponentSetTarget
move.l #$0004FFFA,-(sp)
moveq #0,D0
dc.w $A82A
EndM
ELSE
IMPORT_CFM_FUNCTION ComponentSetTarget
ENDIF
; Component Management routines
;
; pascal void SetComponentInstanceError(ComponentInstance aComponentInstance, OSErr theError)
;
IF ¨ GENERATINGCFM THEN
Macro
_SetComponentInstanceError
moveq #11,D0
dc.w $A82A
EndM
ELSE
IMPORT_CFM_FUNCTION SetComponentInstanceError
ENDIF
;
; pascal long GetComponentRefcon(Component aComponent)
;
IF ¨ GENERATINGCFM THEN
Macro
_GetComponentRefcon
moveq #16,D0
dc.w $A82A
EndM
ELSE
IMPORT_CFM_FUNCTION GetComponentRefcon
ENDIF
;
; pascal void SetComponentRefcon(Component aComponent, long theRefcon)
;
IF ¨ GENERATINGCFM THEN
Macro
_SetComponentRefcon
moveq #17,D0
dc.w $A82A
EndM
ELSE
IMPORT_CFM_FUNCTION SetComponentRefcon
ENDIF
;
; pascal short OpenComponentResFile(Component aComponent)
;
IF ¨ GENERATINGCFM THEN
Macro
_OpenComponentResFile
moveq #21,D0
dc.w $A82A
EndM
ELSE
IMPORT_CFM_FUNCTION OpenComponentResFile
ENDIF
;
; pascal OSErr CloseComponentResFile(short refnum)
;
IF ¨ GENERATINGCFM THEN
Macro
_CloseComponentResFile
moveq #24,D0
dc.w $A82A
EndM
ELSE
IMPORT_CFM_FUNCTION CloseComponentResFile
ENDIF
; Component Instance Management routines
;
; pascal Handle GetComponentInstanceStorage(ComponentInstance aComponentInstance)
;
IF ¨ GENERATINGCFM THEN
Macro
_GetComponentInstanceStorage
moveq #12,D0
dc.w $A82A
EndM
ELSE
IMPORT_CFM_FUNCTION GetComponentInstanceStorage
ENDIF
;
; pascal void SetComponentInstanceStorage(ComponentInstance aComponentInstance, Handle theStorage)
;
IF ¨ GENERATINGCFM THEN
Macro
_SetComponentInstanceStorage
moveq #13,D0
dc.w $A82A
EndM
ELSE
IMPORT_CFM_FUNCTION SetComponentInstanceStorage
ENDIF
;
; pascal long GetComponentInstanceA5(ComponentInstance aComponentInstance)
;
IF ¨ GENERATINGCFM THEN
Macro
_GetComponentInstanceA5
moveq #14,D0
dc.w $A82A
EndM
ELSE
IMPORT_CFM_FUNCTION GetComponentInstanceA5
ENDIF
;
; pascal void SetComponentInstanceA5(ComponentInstance aComponentInstance, long theA5)
;
IF ¨ GENERATINGCFM THEN
Macro
_SetComponentInstanceA5
moveq #15,D0
dc.w $A82A
EndM
ELSE
IMPORT_CFM_FUNCTION SetComponentInstanceA5
ENDIF
;
; pascal long CountComponentInstances(Component aComponent)
;
IF ¨ GENERATINGCFM THEN
Macro
_CountComponentInstances
moveq #19,D0
dc.w $A82A
EndM
ELSE
IMPORT_CFM_FUNCTION CountComponentInstances
ENDIF
; Useful helper routines for convenient method dispatching
;
; pascal long CallComponentFunction(ComponentParameters *params, ComponentFunctionUPP func)
;
IF ¨ GENERATINGCFM THEN
Macro
_CallComponentFunction
moveq #-1,D0
dc.w $A82A
EndM
ELSE
IMPORT_CFM_FUNCTION CallComponentFunction
ENDIF
;
; pascal long CallComponentFunctionWithStorage(Handle storage, ComponentParameters *params, ComponentFunctionUPP func)
;
IF ¨ GENERATINGCFM THEN
Macro
_CallComponentFunctionWithStorage
moveq #-1,D0
dc.w $A82A
EndM
ELSE
IMPORT_CFM_FUNCTION CallComponentFunctionWithStorage
ENDIF
;
; pascal long DelegateComponentCall(ComponentParameters *originalParams, ComponentInstance ci)
;
IF ¨ GENERATINGCFM THEN
Macro
_DelegateComponentCall
moveq #36,D0
dc.w $A82A
EndM
ELSE
IMPORT_CFM_FUNCTION DelegateComponentCall
ENDIF
;
; pascal OSErr SetDefaultComponent(Component aComponent, short flags)
;
IF ¨ GENERATINGCFM THEN
Macro
_SetDefaultComponent
moveq #30,D0
dc.w $A82A
EndM
ELSE
IMPORT_CFM_FUNCTION SetDefaultComponent
ENDIF
;
; pascal ComponentInstance OpenDefaultComponent(OSType componentType, OSType componentSubType)
;
IF ¨ GENERATINGCFM THEN
Macro
_OpenDefaultComponent
moveq #33,D0
dc.w $A82A
EndM
ELSE
IMPORT_CFM_FUNCTION OpenDefaultComponent
ENDIF
;
; pascal Component CaptureComponent(Component capturedComponent, Component capturingComponent)
;
IF ¨ GENERATINGCFM THEN
Macro
_CaptureComponent
moveq #28,D0
dc.w $A82A
EndM
ELSE
IMPORT_CFM_FUNCTION CaptureComponent
ENDIF
;
; pascal OSErr UncaptureComponent(Component aComponent)
;
IF ¨ GENERATINGCFM THEN
Macro
_UncaptureComponent
moveq #29,D0
dc.w $A82A
EndM
ELSE
IMPORT_CFM_FUNCTION UncaptureComponent
ENDIF
;
; pascal long RegisterComponentResourceFile(short resRefNum, short global)
;
IF ¨ GENERATINGCFM THEN
Macro
_RegisterComponentResourceFile
moveq #20,D0
dc.w $A82A
EndM
ELSE
IMPORT_CFM_FUNCTION RegisterComponentResourceFile
ENDIF
;
; pascal OSErr GetComponentIconSuite(Component aComponent, Handle *iconSuite)
;
IF ¨ GENERATINGCFM THEN
Macro
_GetComponentIconSuite
moveq #41,D0
dc.w $A82A
EndM
ELSE
IMPORT_CFM_FUNCTION GetComponentIconSuite
ENDIF
ENDIF
ENDIF ; __COMPONENTS__